<?php

/**
 * Class for controlling the livechat configuration
 *
 * @access 	public
 * @author      Rob
 * @copyright	ResMania 2009-present all rights reserved.
 * @version	1.0
 * @link	http://docs.resmania.com/index.php/LiveChat_Module
 * @since  	09-2010
 */
class RM_LiveChatOperators extends RM_Model {

    protected $_name = 'rm_livechat_operators';

    public function updateOperatorStatus($operatorInfo) {

        // check if record exists
        $where = "operator_id='".$operatorInfo['operator_id']."' OR sid='".$operatorInfo['sid']."'";
        $total = $this->fetchAll($where)->count();

        if ($total>0){
            // update
            return $this->update($operatorInfo, $where);
        } else {
            // insert
            return $this->insert($operatorInfo);
        }

    }

}